package com.xxgc.eow.service.impl;

import com.github.pagehelper.PageHelper;
import com.xxgc.eow.entity.Skill;
import com.xxgc.eow.mapper.SkillMapper;
import com.xxgc.eow.service.ISkillService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 技能表 服务实现类
 * </p>
 *
 * @author Mr.Abel
 * @since 2023-05-23
 */
@Service
public class SkillServiceImpl extends ServiceImpl<SkillMapper, Skill> implements ISkillService {

    @Resource
    private SkillMapper skillMapper;
    @Override
    public int delSkill(Skill skill) {
        return skillMapper.deleteByPrimaryKey(skill);
    }

    @Override
    public List<Skill> getAllBykeyWord(int pageNum, int pageSize, String keyWord) {
        PageHelper.startPage(pageNum,pageSize);
        return skillMapper.selectBYKeyWord(keyWord);
    }

    @Override
    public List<Skill> getAllPage(String keyWord) {
        return skillMapper.selectBYKeyWord(keyWord);
    }

    @Override
    public List<Integer> getIdsByNames(List<String> skillNames) {
        return skillMapper.selectAllIdByName(skillNames);
    }
}
